package com.sample.base.adapter;

import android.view.View;

import androidx.annotation.NonNull;
import androidx.appcompat.widget.AppCompatTextView;
import androidx.recyclerview.widget.RecyclerView;

import com.loyal.adapter.BaseRecycleAdapter;
import com.sample.base.R;

import java.util.List;

public class RecycleViewAdapter extends BaseRecycleAdapter<String, RecycleViewAdapter.ViewHolder> {

    public RecycleViewAdapter(List<String> arrList) {
        super(arrList);
    }

    @Override
    public ViewHolder createViewHolder(View view) {
        return new ViewHolder(view);
    }

    @Override
    public int adapterLayout() {
        return R.layout.item;
    }

    @Override
    public void onViewHolder(@NonNull ViewHolder viewHolder, int position) {
        viewHolder.itemText.setText(getItem(position));
    }

    public static class ViewHolder extends RecyclerView.ViewHolder {
        AppCompatTextView itemText;

        public ViewHolder(View itemView) {
            super(itemView);
            itemText = itemView.findViewById(R.id.itemText);
        }
    }
}
